Help docs

Select a topic from the list.

Code Editor: how to include dynamic content in your email


You can include dynamic content in your email. There are a few standard things, such as an unsubscribe or 'view in browswer' url, but you can also include any custom data you may have imported for your users as well. First, here's list of the built-in ones:

  • unsubscribe link

    To include an automatically generated unsubscribe link you just have to write %%unsubscribe%% in your code. You'll probably want to include it in an anchor tag like this:
    
    <a href="%%unsubscribe%%" target="_blank" linkname="Unsubscribe">Click here to unsubscribe</a>
    
    
  • View in Browser link

    To include an automatically generated 'view in browser' link you just have to write %%view_in_browser%% in your code. You'll probably want to include it in an anchor tag like this:
    
    <a href=%%view_in_browser%%" target="_blank" linkname="View in Browser">View web</a>
    
    
  • First Name

    To include a subscriber's first name you just have to write %%first_name%% in your code. It might look like this:
    
    Greetings %%first_name%%,
    
    
    Of course, you'll probably want to include some logic around that just in case there is no first name. Doing that is easy, but you have to understand a little bit about JavaScript. Click here to learn more: How to use JavaScript in Your Email.
  • Last Name

    To include a subscriber's last name you just have to write %%last_name%% in your code. It might look like this:
    
    Greetings %%first_name%% %%last_name%%,
    
    
    Again, you'll probably want to include some logic around that just in case there is no last name. Click here to learn more: How to use JavaScript in Your Email.
  • Email

    To include a subscriber's email address in your HTML you just have to write %%email%% in your code. It might look like this:
    
    Your email is: %%email%%,
    
    

You can easily personalize emails by simply wrapping any custom data in double percent signs. Here's how:

  1. Import CSV Subscriber List with Custom Data

    If you are unsure how to import a CSV Subscriber List you can click here to learn how: How to import subscribers. When you import a CSV you most certainly want to include an email address. You may even want to include a first name and last name. Another powerful aspect of Serious Email is that you can import other data as well. For example, maybe you have an incentive program for your business's users and you want to display how many points your user's have acquired. To do that, we need to import it.

    So, your CSV would look something like this:
    
    first_name, last_name, email, points
    John, Smith, [email protected], 100
    Sue, Struthers, [email protected], 222	
    
    
  2. Add it to your Template

    In our example above, notice the last word in the top row - 'points'. This is a column in your CSV and the two user's we're importing have a points value of 100 and 222 respectively. Once imported you can display each user's points simply by wrapping the column name in double percentage signs.

    Here's an example of this in your HTML:
    
    Your have %%points%% total points!